package edu.ustb.efws.base.domain;

import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * 报警设置
 *
 * @author TS Group
 */
public class Alarm {
    @ApiModelProperty(value = "编号")
    private Long id;
    @ApiModelProperty(value = "用户编号")
    private Long userId;
    @ApiModelProperty(value = "钉钉用户编号")
    private String ddUserId;
    @ApiModelProperty("姓名")
    private String name;
    @ApiModelProperty(value = "接收报警点集合")
    private List<SimplePosition> positions;
    @ApiModelProperty(value = "启用报警")
    private Boolean enable;
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    @ApiModelProperty(value = "修改时间")
    private Date updateTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getDdUserId() {
        return ddUserId;
    }

    public void setDdUserId(String ddUserId) {
        this.ddUserId = ddUserId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<SimplePosition> getPositions() {
        return positions;
    }

    public void setPositions(List<SimplePosition> positions) {
        this.positions = positions;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Alarm alarm = (Alarm) o;
        return Objects.equals(id, alarm.id) && Objects.equals(userId, alarm.userId) && Objects.equals(ddUserId, alarm.ddUserId) && Objects.equals(name, alarm.name) && Objects.equals(positions, alarm.positions) && Objects.equals(enable, alarm.enable) && Objects.equals(createTime, alarm.createTime) && Objects.equals(updateTime, alarm.updateTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userId, ddUserId, name, positions, enable, createTime, updateTime);
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("id", id)
                .append("userId", userId)
                .append("ddUserId", ddUserId)
                .append("name", name)
                .append("positions", positions)
                .append("enable", enable)
                .append("createTime", createTime)
                .append("updateTime", updateTime)
                .toString();
    }

    public static class SimplePosition {
        @ApiModelProperty("编号")
        private Integer id;
        @ApiModelProperty("风险值输出位置")
        private String riskArea;
        @ApiModelProperty("风险值输出点位置显示")
        private String riskPosition;

        public Integer getId() {
            return id;
        }

        public void setId(Integer id) {
            this.id = id;
        }

        public String getRiskArea() {
            return riskArea;
        }

        public void setRiskArea(String riskArea) {
            this.riskArea = riskArea;
        }

        public String getRiskPosition() {
            return riskPosition;
        }

        public void setRiskPosition(String riskPosition) {
            this.riskPosition = riskPosition;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            SimplePosition that = (SimplePosition) o;
            return Objects.equals(id, that.id) && Objects.equals(riskArea, that.riskArea) && Objects.equals(riskPosition, that.riskPosition);
        }

        @Override
        public int hashCode() {
            return Objects.hash(id, riskArea, riskPosition);
        }

        @Override
        public String toString() {
            return new ToStringBuilder(this)
                    .append("id", id)
                    .append("riskArea", riskArea)
                    .append("riskPosition", riskPosition)
                    .toString();
        }
    }
}
